package org.example.lease.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.example.lease.mapper.SystemUserMapper;
import org.example.lease.model.entities.SystemUser;
import org.example.lease.service.SystemUserService;
import org.example.lease.vo.system.user.SystemUserItemVo;
import org.example.lease.vo.system.user.SystemUserQueryVo;
import org.springframework.stereotype.Service;


/**
 * @author 宋孟林
 * @description
 * @date: 2025/5/12 16:52
 */
@Service
@Slf4j
public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemUser> implements SystemUserService {
    @Resource
    private SystemUserMapper systemUserMapper;

    @Override
    public IPage<SystemUserItemVo> selectPageForSysUserItemVoByQuery(IPage<SystemUserItemVo> page,
                                                                     SystemUserQueryVo systemUserQueryVo) {
        IPage<SystemUserItemVo> systemUserItemVoIPage = systemUserMapper.selectPageForSysUserItemVoByQuery(page, systemUserQueryVo);
        log.info("打印分页日志：{}", systemUserItemVoIPage.getRecords());
        return systemUserItemVoIPage;
    }

    @Override
    public SystemUserItemVo selectSystemUserItemVoById(Long id) {
        SystemUserItemVo systemUserItemVo = systemUserMapper.selectSystemUserItemVoById(id);
        log.info("系统与用户vo为：{}", systemUserItemVo);
        return systemUserItemVo;
    }

    @Override
    public SystemUser selectSystemUserByUserName(String username) {
        SystemUser systemUser = systemUserMapper.selectSystemUserByUserName(username);
        log.info("用户为：{}", systemUser);
        return systemUser;
    }
}




